
********************************************************************************
*********************************** Figure 1 ***********************************
********************************************************************************

cd "C:\Users\Au283015\Dropbox\My Stata files\Analysis for papers\Repression paper\BJPS dataverse"
use "Turning a Blind Eye to Repression Dataset.dta", clear

graph set window fontface "Garamond" 
graph set window fontfacemono "Garamond"
graph set window fontfacesans "Garamond"
graph set window fontfaceserif "Garamond"


reg reaction_approve c.treat_reaction##c.treat_like_group, r
histogram like_coal if e(sample), plotr(m(vsmall)) discrete width(.5) freq  xlabel(0(1)4, labsize(*2) nogrid noticks) ///
color(gs11) lcolor(gs11) lpattern(solid) ylabel(0(500)2000, labsize(*2)  noticks nogrid angle(90)) xtitle("") ///
ytitle("", size(zero) margin(zero)) graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) ///
title("Coal mine workers", color(black) size(*2.2)) ///
xsize(15) ysize(20) 
graph save cm, replace

reg reaction_approve c.treat_reaction##c.treat_like_group, r
histogram like_sup_nav if e(sample), plotr(m(vsmall)) discrete width(.5) freq  xlabel(0(1)4, labsize(*2) nogrid noticks) ///
color(gs11) lcolor(gs11) lpattern(solid) ylabel(0(500)2000, labsize(*2)  noticks nogrid angle(90)) xtitle("") ///
ytitle("", size(zero) margin(zero)) graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) ///
title("Navalny supporters", color(black) size(*2.2)) ///
xsize(15) ysize(20) 
graph save nv, replace

reg reaction_approve c.treat_reaction##c.treat_like_group, r
histogram like_rus_nat if e(sample), plotr(m(vsmall)) discrete width(.5) freq  xlabel(0(1)4, labsize(*2) nogrid noticks) ///
color(gs11) lcolor(gs11) lpattern(solid) ylabel(0(500)2000, labsize(*2)  noticks nogrid angle(90)) xtitle("") ///
ytitle("", size(zero) margin(zero)) graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) ///
title("Russian nationalists", color(black) size(*2.2)) ///
xsize(15) ysize(20) 
graph save rn, replace

reg reaction_approve c.treat_reaction##c.treat_like_group, r
histogram like_com if e(sample), plotr(m(vsmall)) discrete width(.5) freq  xlabel(0(1)4, labsize(*2) nogrid noticks) ///
color(gs11) lcolor(gs11) lpattern(solid) ylabel(0(500)2000, labsize(*2)  noticks nogrid angle(90)) xtitle("") ///
ytitle("", size(zero) margin(zero)) graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) ///
title("Communists", color(black) size(*2.2)) ///
xsize(15) ysize(20) 
graph save co, replace

reg reaction_approve c.treat_reaction##c.treat_like_group, r
histogram like_gay_les if e(sample), plotr(m(vsmall)) discrete width(.5) freq  xlabel(0(1)4, labsize(*2) nogrid noticks) ///
color(gs11) lcolor(gs11) lpattern(solid) ylabel(0(500)2000, labsize(*2)  noticks nogrid angle(90)) xtitle("") ///
ytitle("", size(zero) margin(zero)) graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) ///
title("LGBT groups", color(black) size(*2.2)) ///
xsize(15) ysize(20) 
graph save gl, replace

graph combine nv.gph gl.gph rn.gph co.gph cm.gph, xsize(20) ysize(6) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) rows(1) cols(5) 



********************************************************************************
*********************************** Figure 2 ***********************************
********************************************************************************

cd "C:\Users\Au283015\Dropbox\My Stata files\Analysis for papers\Repression paper\BJPS dataverse"
use "Turning a Blind Eye to Repression Dataset.dta", clear

reg reaction_approve c.treat_reaction##c.treat_like_group, r

hist reaction_approve if e(sample) & treat_reaction==0, ///
plotr(m(vsmall)) ytitle("", size(medsmall) margin(small)) discrete width(.5) freq  ///
xlabel(0(1)4, labsize(4) nogrid) ///
ylabel(0(250)750, labsize(4) norescale nogrid angle(90)) color(gs11) lcolor(gs11) lpattern(solid) ///
xtitle("Approve reaction", color(black) size(6.5)) ytitle("") title("", color(black) size(*1.9)  margin(medium)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(3 6 3 3)) ///
title("Protest allowed", color(black) size(*1.1)) ///
legend(off) xsize(20) ysize(16) 
graph save rea_norep, replace


hist reaction_approve if e(sample) & treat_reaction==1, ///
plotr(m(vsmall)) ytitle("", size(medsmall) margin(small)) discrete width(.5) freq  ///
xlabel(0(1)4, labsize(4) nogrid) ///
ylabel(0(250)750, labsize(4) norescale nogrid angle(90)) color(gs11) lcolor(gs11) lpattern(solid) ///
xtitle("Approve reaction", color(black) size(6.5)) ytitle("") title("", color(black) size(*1.9)  margin(medium)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(3 6 3 3)) ///
title("Protest repressed", color(black) size(*1.1)) ///
legend(off) xsize(20) ysize(16) 
graph save rea_rep, replace


hist putin_approve if e(sample) & treat_reaction==0, ///
plotr(m(vsmall)) ytitle("", size(medsmall) margin(small)) discrete width(.5) freq  ///
xlabel(0(1)4, labsize(4) nogrid) ///
ylabel(0(250)750, labsize(4) norescale nogrid angle(90)) color(gs11) lcolor(gs11) lpattern(solid) ///
xtitle("Approve Putin", color(black) size(6.5)) ytitle("") title("", color(black) size(*1.9)  margin(medium)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(3 6 3 3)) ///
title("Protest allowed", color(black) size(*1.1)) ///
legend(off) xsize(20) ysize(16) 
graph save put_norep, replace


hist putin_approve if e(sample) & treat_reaction==1, ///
plotr(m(vsmall)) ytitle("", size(medsmall) margin(small)) discrete width(.5) freq  ///
xlabel(0(1)4, labsize(3.5) nogrid) ///
ylabel(0(250)750, labsize(4) norescale nogrid angle(90)) color(gs11) lcolor(gs11) lpattern(solid) ///
xtitle("Approve Putin", color(black) size(6.5)) ytitle("") title("", color(black) size(*1.9)  margin(medium)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(3 6 3 3)) ///
title("Protest repressed", color(black) size(*1.1)) ///
legend(off) xsize(20) ysize(16) 
graph save put_rep, replace

graph combine rea_norep.gph rea_rep.gph put_norep.gph put_rep.gph, xsize(20) ysize(8) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) rows(1) cols(4) 



********************************************************************************
*********************************** Figure 3 ***********************************
********************************************************************************
cd "C:\Users\Au283015\Dropbox\My Stata files\Analysis for papers\Repression paper\BJPS dataverse"
use "Turning a Blind Eye to Repression Dataset.dta", clear

graph set window fontface "Garamond" 
graph set window fontfacemono "Garamond"
graph set window fontfacesans "Garamond"
graph set window fontfaceserif "Garamond"

* All *
cls
reg reaction_approve c.treat_reaction##c.treat_like_group, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", color(white) margin(small) size(*1.0))  ///
ytitle("Approval reaction", margin(small) size(*1.5)) ///
title("All", size(*1.4) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.8) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_all, replace


* Putin supporters *
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if putin_sup==1, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", color(white) margin(small) size(*1.0))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.5)) ///
title("Regime supporters", size(*1.4) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.8) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_sup, replace


* Putin opponents *
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if putin_sup==0, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", color(white) margin(small) size(*1.0))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.5)) ///
title("Regime non-supporters", size(*1.4) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.8) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_opp, replace


****************************
* All *
cls
reg reaction_approve c.treat_reaction##c.treat_like_group, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle(" ", color(white) margin(small) size(*1.0))  ///
ytitle("Marginal effects", margin(small) size(*1.5)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
graph save marg_all, replace


* Putin supporters *
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if putin_sup==1, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle(" ", color(white) margin(small) size(*1.0))  ///
ytitle("Marginal effects", color(white) margin(small) size(*1.5)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_sup, replace


* Putin opponents *
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if putin_sup==0, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle(" ", color(white) margin(small) size(*1.0))  ///
ytitle("Marginal effects", color(white) margin(small) size(*1.5)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_opp, replace


****************************
* All categorical *
cls
reg reaction_approve c.treat_reaction##i.treat_like_group, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle("", margin(small) size(*1.0))  ///
ytitle("Approval reaction", margin(small) size(*1.5)) ///
title(" ", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.8) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_all_i, replace


* Putin supporters categorical *
cls
reg reaction_approve c.treat_reaction##i.treat_like_group if putin_sup==1, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle("",  margin(small) size(*1.0))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.5)) ///
title(" ", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.8) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
graph save pred_sup_i, replace


* Putin opponents categorical *
cls
reg reaction_approve c.treat_reaction##i.treat_like_group if putin_sup==0, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle("", margin(small) size(*1.0))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.5)) ///
title(" ", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.8) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_opp_i, replace


****************************
* All categorical *
cls
reg reaction_approve c.treat_reaction##i.treat_like_group, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle("Sympathy group", margin(small) size(*1.6))  ///
ytitle("Marginal effects", margin(small) size(*1.5)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 


graph save marg_all_i, replace


* Putin supporters categorical *
cls
reg reaction_approve c.treat_reaction##i.treat_like_group if putin_sup==1, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle("Sympathy group", margin(small) size(*1.6))  ///
ytitle("Marginal effects", color(white) margin(small) size(*1.5)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_sup_i, replace


* Putin opponents categorical *
cls
reg reaction_approve c.treat_reaction##i.treat_like_group if putin_sup==0, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.3)) ///
xtitle("Sympathy group", margin(small) size(*1.6))  ///
ytitle("Marginal effects", color(white) margin(small) size(*1.5)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_opp_i, replace


graph combine pred_all.gph pred_sup.gph pred_opp.gph marg_all.gph marg_sup.gph marg_opp.gph pred_all_i.gph pred_sup_i.gph pred_opp_i.gph marg_all_i.gph marg_sup_i.gph marg_opp_i.gph, xsize(10) ysize(12) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) rows(4) cols(3) 


********************************************************************************
********************************************************************************
*********************************** Figure 4 ***********************************
********************************************************************************
********************************************************************************

cd "C:\Users\Au283015\Dropbox\My Stata files\Analysis for papers\Repression paper\BJPS dataverse"
use "Turning a Blind Eye to Repression Dataset.dta", clear

*tab reaction_approve if e(sample) & treat_reaction==1

graph set window fontface "Garamond" 
graph set window fontfacemono "Garamond"
graph set window fontfacesans "Garamond"
graph set window fontfaceserif "Garamond"

reg reaction_approve c.treat_reaction##c.treat_like_group, r

graph pie if e(sample) & treat_reaction==1 & treat_like_group==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 0_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 0_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==0 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 0_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==0 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 0_opp, replace


graph pie if e(sample) & treat_reaction==1 & treat_like_group==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 1_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==1 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 1_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==1 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 1_opp, replace


graph pie if e(sample) & treat_reaction==1 & treat_like_group==2, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 2_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==2 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 2_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==2 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 2_opp, replace


graph pie if e(sample) & treat_reaction==1 & treat_like_group==3, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 3_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==3 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 3_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==3 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 3_opp, replace


graph pie if e(sample) & treat_reaction==1 & treat_like_group==4, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 4_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==4 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 4_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_like_group==4 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save 4_opp, replace


graph combine 0_all.gph 0_sup.gph 0_opp.gph 1_all.gph 1_sup.gph 1_opp.gph 2_all.gph 2_sup.gph 2_opp.gph 3_all.gph 3_sup.gph 3_opp.gph 4_all.gph 4_sup.gph 4_opp.gph, xsize(15) ysize(20) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero)) plotregion(margin(zero)) rows(5) cols(3) imargin(zero)


********************************************************************************
*********************************** Figure 5 ***********************************
********************************************************************************
cd "C:\Users\Au283015\Dropbox\My Stata files\Analysis for papers\Repression paper\BJPS dataverse"
use "Turning a Blind Eye to Repression Dataset.dta", clear

graph set window fontface "Garamond" 
graph set window fontfacemono "Garamond"
graph set window fontfacesans "Garamond"
graph set window fontfaceserif "Garamond"

* Groups - All *
forvalues g=0(1)4 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g', r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle(" ", color(white) margin(small) size(*1.6))  ///
ytitle("Approval reaction", color(black) margin(small) size(*1.6) angle(90)) ///
title(" ", size(*1.3) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off)  ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g', replace

}

* Groups - Putin supporters *
forvalues g=0(1)4 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g' & putin_sup==1, r
margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle("Sympathy group", color(white) margin(small) size(*1.6))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.6)) ///
title(" ", size(*1.3) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g'_sup, replace

}


* Groups - Putin opponents *
forvalues g=0(1)4 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g' & putin_sup==0, r
margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle(" ", margin(small) size(*1.6))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.6)) ///
title(" ", size(*1.3) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g'_opp, replace

}




*** Row 1 column 1-3 ***

forvalues g=1(1)1 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g', r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle(" ", color(white) margin(small) size(*1.6))  ///
ytitle("Approval reaction", color(black) margin(small) size(*1.6) angle(90)) ///
title(" ", size(*1.8) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off)  ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g', replace

}


forvalues g=1(1)1 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g' & putin_sup==1, r
margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle(" ", color(white) margin(small) size(*1.6))  ///
ytitle(" ", color(black) margin(small) size(*1.6)) ///
title(" ", size(*1.8) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g'_sup, replace

}

forvalues g=1(1)1 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g' & putin_sup==0, r
margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle(" ", margin(small) size(*1.6))  ///
ytitle(" ", color(black) margin(small) size(*1.6)) ///
title(" ", size(*1.8) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g'_opp, replace
}





*** Row 5 column 1-3 ***

forvalues g=0(1)0 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g', r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle("Sympathy group", color(black) margin(small) size(*1.8))  ///
ytitle("Approval reaction", color(black) margin(small) size(*1.6) angle(90)) ///
title(" ", size(*1.3) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off)  ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g', replace

}

forvalues g=0(1)0 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g' & putin_sup==1, r
margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle("Sympathy group", color(black) margin(small) size(*1.8))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.6)) ///
title(" ", size(*1.3) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g'_sup, replace

}


forvalues g=0(1)0 {
local lab : label (treat_group) `g'
cls
reg reaction_approve c.treat_reaction##c.treat_like_group if treat_group==`g' & putin_sup==0, r
margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*1.0) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*1.0) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(*1.2)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(*1.2)) ///
xtitle("Sympathy group", color(black) margin(small) size(*1.8))  ///
ytitle("Approval reaction", color(white) margin(small) size(*1.6)) ///
title(" ", size(*1.3) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) legend(off) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 800, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
 
graph save pred_`g'_opp, replace

}



graph combine pred_1.gph pred_1_sup.gph pred_1_opp.gph pred_4.gph pred_4_sup.gph pred_4_opp.gph pred_2.gph pred_2_sup.gph pred_2_opp.gph pred_3.gph pred_3_sup.gph pred_3_opp.gph pred_0.gph pred_0_sup.gph pred_0_opp.gph, xsize(14) ysize(20) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) rows(5) cols(3) 


********************************************************************************
*********************************** Figure 6 ***********************************
********************************************************************************
cd "C:\Users\Au283015\Dropbox\My Stata files\Analysis for papers\Repression paper\BJPS dataverse"
use "Turning a Blind Eye to Repression Dataset.dta", clear

*tab reaction_approve if e(sample) & treat_reaction==1

graph set window fontface "Garamond" 
graph set window fontfacemono "Garamond"
graph set window fontfacesans "Garamond"
graph set window fontfaceserif "Garamond"

reg reaction_approve c.treat_reaction##c.treat_like_group, r



graph pie if e(sample) & treat_reaction==1 & treat_group==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save nav_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==1 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save nav_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==1 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save nav_opp, replace



graph pie if e(sample) & treat_reaction==1 & treat_group==4, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save lgbt_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==4 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save lgbt_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==4 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save lgbt_opp, replace


graph pie if e(sample) & treat_reaction==1 & treat_group==2, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save nat_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==2 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save nat_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==2 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save nat_opp, replace


graph pie if e(sample) & treat_reaction==1 & treat_group==3, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save com_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==3 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save com_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==3 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save com_opp, replace



graph pie if e(sample) & treat_reaction==1 & treat_group==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0) color(black)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save coal_all, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==0 & putin_sup==1, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save coal_sup, replace

graph pie if e(sample) & treat_reaction==1 & treat_group==0 & putin_sup==0, over(reaction_approve_cat3) pie(1, color(cranberry%90)) pie(2, color(gs8%90)) pie(3, color(dkgreen%90) explode(8)) ///
plabel(_all percent, format(%5.0f) gap(-8.0) size(6) color(black)) title("", size(*0)) plotregion(margin(0 0 0 0)) ///
line(lcolor(black) lwidth(vthin)) intensity(inten70) legend(off) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero))  
graph save coal_opp, replace



graph combine nav_all.gph nav_sup.gph nav_opp.gph lgbt_all.gph lgbt_sup.gph lgbt_opp.gph nat_all.gph nat_sup.gph nat_opp.gph com_all.gph com_sup.gph com_opp.gph coal_all.gph coal_sup.gph coal_opp.gph, xsize(15) ysize(20) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white) margin(zero)) plotregion(margin(zero)) rows(5) cols(3) imargin(zero)


********************************************************************************
*********************************** Figure 7 ***********************************
********************************************************************************
cd "C:\Users\Au283015\Dropbox\My Stata files\Analysis for papers\Repression paper\BJPS dataverse"
use "Turning a Blind Eye to Repression Dataset.dta", clear

graph set window fontface "Garamond" 
graph set window fontfacemono "Garamond"
graph set window fontfacesans "Garamond"
graph set window fontfaceserif "Garamond"

* All *
cls
reg putin_approve c.treat_reaction##c.treat_like_group, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", color(white) margin(small) size(*1.0))  ///
ytitle("Approval Putin", margin(small) size(*1.4)) ///
title("All", size(*1.6) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.7) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_all, replace


* Putin supporters *
cls
reg putin_approve c.treat_reaction##c.treat_like_group if putin_sup==1, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", color(white) margin(small) size(*1.0))  ///
ytitle("Approval Putin", color(white) margin(small) size(*1.0)) ///
title("Regime supporters", size(*1.6) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.7) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_sup, replace


* Putin opponents *
cls
reg putin_approve c.treat_reaction##c.treat_like_group if putin_sup==0, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", color(white) margin(small) size(*1.0))  ///
ytitle("Approval Putin", color(white) margin(small) size(*1.0)) ///
title("Regime non-supporters", size(*1.6) color(black) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.7) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_opp, replace


****************************
* All *
cls
reg putin_approve c.treat_reaction##c.treat_like_group, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle(" ", color(white) margin(small) size(*1.0))  ///
ytitle("Marginal effects", margin(small) size(*1.4)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
graph save marg_all, replace


* Putin supporters *
cls
reg putin_approve c.treat_reaction##c.treat_like_group if putin_sup==1, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle(" ", color(white) margin(small) size(*1.0))  ///
ytitle(" ", margin(small) size(*1.0)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_sup, replace


* Putin opponents *
cls
reg putin_approve c.treat_reaction##c.treat_like_group if putin_sup==0, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle(" ", color(white) margin(small) size(*1.0))  ///
ytitle(" ", margin(small) size(*1.0)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_opp, replace


****************************
* All categorical *
cls
reg putin_approve c.treat_reaction##i.treat_like_group, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", margin(small) size(*1.0))  ///
ytitle("Approval Putin", margin(small) size(*1.4)) ///
title(" ", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.7) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_all_i, replace


* Putin supporters categorical *
cls
reg putin_approve c.treat_reaction##i.treat_like_group if putin_sup==1, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("",  margin(small) size(*1.0))  ///
ytitle("Approval Putin", color(white) margin(small) size(*1.0)) ///
title(" ", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.7) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 
graph save pred_sup_i, replace


* Putin opponents categorical *
cls
reg putin_approve c.treat_reaction##i.treat_like_group if putin_sup==0, r

margins, at(treat_like_group = (0(1)4) treat_reaction = (0 1)) level(95) asobserved 
marginsplot, ///
plotopts(mcolor(midblue) mlabcolor(midblue) lpattern(solid) lcolor(midblue) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(midblue%30) lcolor(midblue%0) lwidth(thin)) recastci(rarea) ///
plot2opts(mcolor(cranberry) mlabcolor(cranberry) lpattern(solid) lcolor(cranberry) msymbol(square) msize(*0.8) mlwidth(*0.35)) ci2opts(color(cranberry%30) lcolor(cranberry%0) lwidth(thin)) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(0(1)4, nogrid labsize(3.0)) plotr(m(medsmall)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("", margin(small) size(*1.0))  ///
ytitle("Approval Putin", color(white) margin(small) size(*1.0)) ///
title(" ", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 4) label(3 "Protest allowed") label(4 "Protest repressed") size(*0.7) symxsize(*.65) symysize(*.25) forcesize ring(0) position(11) keygap(*.1) colgap(tiny) rowgap(tiny) row(1)) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(all region(lstyle(none) color(none) lcolor(none) icolor(none) fcolor(none) ilcolor(none) ifcolor(none)) order(3 "Protest allowed" 4 "Protest repressed") size(*1.6) position(11) keygap(*10.6) colgap(tiny) rowgap(0.1) row(2) col(1)) ///
ylabel(0(1)4, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save pred_opp_i, replace


****************************
* All categorical *
cls
reg putin_approve c.treat_reaction##i.treat_like_group, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("Sympathy group", margin(small) size(*1.4))  ///
ytitle("Marginal effects", margin(small) size(*1.4)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 


graph save marg_all_i, replace


* Putin supporters categorical *
cls
reg putin_approve c.treat_reaction##i.treat_like_group if putin_sup==1, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("Sympathy group", margin(small) size(*1.4))  ///
ytitle(" ", margin(small) size(*1.0)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_sup_i, replace


* Putin opponents categorical *
cls
reg putin_approve c.treat_reaction##i.treat_like_group if putin_sup==0, r

margins, dydx(treat_reaction) at(treat_like_group = (0(1)4)) asobserved level(95)
marginsplot, ///
plotopts(mcolor(black) mlabcolor(black) lpattern(solid) lcolor(black) msymbol(circle) msize(*0.8) mlwidth(*0.35)) ciopts(color(black%30) lcolor(black%0) lwidth(thin)) recastci(rarea) ///
level(95) graphregion(fcolor(white) lcolor(white) margin(small)) ///
ylabel(-3(1)3, nogrid labsize(3.0)) plotr(m(medsmall)) ///
yline(0, lcolor(black) lwidth(thin)) ///
xlabel(0(1)4, nogrid labsize(3.0)) ///
xtitle("Sympathy group", margin(small) size(*1.4))  ///
ytitle(" ", margin(small) size(*1.0)) ///
title("", size(*1.4) color(white) span margin(1 1 3 1)) ///
graphregion(fcolor(white) lcolor(white) margin(medium)) plotr(m(medsmall)) ///
legend(off) xsize(20) ysize(10) ///
addplot((histogram treat_like_group if e(sample), plotr(m(vsmall)) discrete width(0.25) freq yaxis(2) xlabel(0(1)4, nogrid labsize(*1))  ///
legend(off) ///
ylabel(-3(1)3, nogrid labsize(*1.2) norescale) color(gs12%30) lcolor(gs11%8) lpattern(solid) ylabel(0 3000, nolabels noticks axis(2)) ///
ytitle("", size(zero) margin(zero) axis(2)) yscale(lstyle(none) titlegap(0) outergap(0) axis(2))))  graphregion(fcolor(white) lcolor(white) margin(small)) plotr(m(small)) 

graph save marg_opp_i, replace


graph combine pred_all.gph pred_sup.gph pred_opp.gph marg_all.gph marg_sup.gph marg_opp.gph pred_all_i.gph pred_sup_i.gph pred_opp_i.gph marg_all_i.gph marg_sup_i.gph marg_opp_i.gph, xsize(10) ysize(12) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) rows(4) cols(3) 

